package course.requirements;

import java.util.Collection;

import course.Course;

public class MultipleCourseRequirement implements Requirement<Collection<Course>> {

	private static final RequirementType TYPE = RequirementType.MULTIPLE;
	
	private final Collection<Course> REQUIREMENTS;
	
	public MultipleCourseRequirement(Collection<Course> courses) {
		REQUIREMENTS = courses;
	}
	
	@Override
	public Collection<Course> getRequirement() {
		return REQUIREMENTS;
	}
	
	@Override
	public RequirementType getRequirementType() {
		return TYPE;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((REQUIREMENTS == null) ? 0 : REQUIREMENTS.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		MultipleCourseRequirement other = (MultipleCourseRequirement) obj;
		if (REQUIREMENTS == null) {
			if (other.REQUIREMENTS != null) {
				return false;
			}
		} else if (!REQUIREMENTS.equals(other.REQUIREMENTS)) {
			return false;
		}
		return true;
	}
}
